﻿using System;
using MathNet.Numerics;
using RayDen.Library.Components.Surface.Microfacet;
using RayDen.Library.Core.Primitives;



namespace RayDen.Library.Components.Surface
{
    /*
    [Serializable]
    public class WignerDistributionBrdf : SurfaceBsdf
    {
        private MicrofacetDistribution dist;
        private WDF2D u_d, v_d;
        private RgbSpectrum Ks;

        public WignerDistributionBrdf(MicrofacetDistribution mfc, RgbSpectrum ks)
        {
            Ks = ks;
            dist = mfc;
            u_d = new WDF2D();
            v_d = new WDF2D();
        }

        public override void f(ref Vector wo, ref Vector wi, ref Normal N, ref RgbSpectrum in_fs, out RgbSpectrum fs)
        {
            var wh = (wi + wo).Normalize();
            var d = dist.D(ref wh);

            float u = 0;
            float v = 0;

            fs = Ks;//*u.getValue()
        }

        public override BrdfType Type
        {
            get { return BrdfType.Glossy; }
        }

        public override bool IsDiffuse()
        {
            return true;
        }

        public override bool IsSpecular()
        {
            return false;
        }
    }


    public class WDF2D
    {
        private MicrofacetDistribution d;
        private Complex32[] g, mutualIntensity;
        int mLength;
        bool mOutput;

        float deltax;
        float deltau;

        float mMax;

        public int Dimensions
        {
            get { return 2; }
        }

        private float[] wdf;

        public WDF2D()
        {
            
        }

        public void Build()
        {

        }
        public int Length(int dimension = 0) { return mLength; }
        public double getValue(int x = 0, int y = 0) { return wdf[y + x * mLength]; }
        public float getMax() { return mMax; }

        public float getMaxU() { return deltau * mLength / 2.0f; }


        public void setDeltaXU(float x, float u) { deltax = x; deltau = u; }

    }
     */ 
}